#include "sResourcePreset.h"
#include "sResource.h"
#include "sEngineItem.h"
#include "sEngine.h"

namespace sgui
{
namespace preset
{
	
const res::sResource& sPreset::getResource() const
{
	return m_resource;
}
    
void sPreset::load(const db::Record &file)
{
    //
}

void sPreset::save(db::Record &file) const
{
	file[L"resource"].Set(m_resource.getID());
}
		
engine::sEngineItem* sPreset::getEngineItem()
{
	return m_engineItem;
}
	
const engine::sEngineItem* sPreset::getEngineItem() const
{
	return m_engineItem;
}

void sPreset::init(engine::sEngine& engine)
{
	sPreset::clear();
	m_engineItem = createEngineItem(engine);
}

void sPreset::clear()
{
    if (m_engineItem)
	{
		delete m_engineItem;
		m_engineItem = NULL;
	}
}

sPreset::sPreset(sGUI&gui, const std::wstring& name, const res::sResource& resource) :
	m_resource(resource),
    sNamedObject(gui, name),
	m_engineItem(NULL)
{
    //
}
    
#ifdef _EDITOR
void sPreset::exportRTTI(rtti::sInfoList& list)
{
    sNamedObject::exportRTTI(list);
}
#endif

};
};